﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DLGameCore.Controller;
using DLGameCore.GameModel.State;
using DLGameCore.Utility;
using SuperMarioVN.GameModel.State;

namespace SuperMarioVN.Controller
{
    public class MGameManager: GameManager
    {
        public override CGameState controlState()
        {
            string classStateName = StringUtility.getClassState(EState.ToString());

            foreach (CGameState gameState in gameStates)
            {
                if (gameState.state.Equals(EState))
                {
                    return gameState;
                }
            }

            CGameState newState = (CGameState)Activator.CreateInstance(Type.GetType("SuperMarioVN.GameModel.State."+classStateName));
            newState.initialize();
            gameStates.Add(newState);
            return newState;
        }
    }
}
